package com.xjgzinfo.usdp.service.dto;

import com.xjgzinfo.usdp.jpa.service.Criteria;
import com.xjgzinfo.usdp.jpa.service.filter.Filter;
import com.xjgzinfo.usdp.jpa.service.filter.LongFilter;
import com.xjgzinfo.usdp.jpa.service.filter.StringFilter;

import java.io.Serializable;
import java.util.Objects;

/**
 * Criteria class for the {@link com.xjgzinfo.usdp.domain.AppFile} entity. This class is used
 * in {@link com.xjgzinfo.usdp.web.rest.AppFileResource} to receive all the possible filtering options from
 * the Http GET request parameters.
 * For example the following could be a valid request:
 * {@code /app-files?id.greaterThan=5&attr1.contains=something&attr2.specified=false}
 * As Spring is unable to properly convert the types, unless specific {@link Filter} class are used, we need to use
 * fix type specific filters.
 */
public class AppFileCriteria implements Serializable, Criteria {

    private static final long serialVersionUID = 1L;

    private LongFilter id;

    private LongFilter fileId;

    private StringFilter fileName;

    private StringFilter fileUri;

    private StringFilter originalFileName;

    private StringFilter filePath;

    private LongFilter userId;

    public AppFileCriteria() {
    }

    public AppFileCriteria(AppFileCriteria other) {
        this.id = other.id == null ? null : other.id.copy();
        this.fileId = other.fileId == null ? null : other.fileId.copy();
        this.fileName = other.fileName == null ? null : other.fileName.copy();
        this.fileUri = other.fileUri == null ? null : other.fileUri.copy();
        this.originalFileName = other.originalFileName == null ? null : other.originalFileName.copy();
        this.filePath = other.filePath == null ? null : other.filePath.copy();
        this.userId = other.userId == null ? null : other.userId.copy();
    }

    @Override
    public AppFileCriteria copy() {
        return new AppFileCriteria(this);
    }

    public LongFilter getId() {
        return id;
    }

    public void setId(LongFilter id) {
        this.id = id;
    }

    public LongFilter getFileId() {
        return fileId;
    }

    public void setFileId(LongFilter fileId) {
        this.fileId = fileId;
    }

    public StringFilter getFileName() {
        return fileName;
    }

    public void setFileName(StringFilter fileName) {
        this.fileName = fileName;
    }

    public StringFilter getFileUri() {
        return fileUri;
    }

    public void setFileUri(StringFilter fileUri) {
        this.fileUri = fileUri;
    }

    public StringFilter getOriginalFileName() {
        return originalFileName;
    }

    public void setOriginalFileName(StringFilter originalFileName) {
        this.originalFileName = originalFileName;
    }

    public StringFilter getFilePath() {
        return filePath;
    }

    public void setFilePath(StringFilter filePath) {
        this.filePath = filePath;
    }

    public LongFilter getUserId() {
        return userId;
    }

    public void setUserId(LongFilter userId) {
        this.userId = userId;
    }


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        final AppFileCriteria that = (AppFileCriteria) o;
        return
                Objects.equals(id, that.id) &&
                        Objects.equals(fileId, that.fileId) &&
                        Objects.equals(fileName, that.fileName) &&
                        Objects.equals(fileUri, that.fileUri) &&
                        Objects.equals(originalFileName, that.originalFileName) &&
                        Objects.equals(filePath, that.filePath) &&
                        Objects.equals(userId, that.userId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(
                id,
                fileId,
                fileName,
                fileUri,
                originalFileName,
                filePath,
                userId
        );
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "AppFileCriteria{" +
                (id != null ? "id=" + id + ", " : "") +
                (fileId != null ? "fileId=" + fileId + ", " : "") +
                (fileName != null ? "fileName=" + fileName + ", " : "") +
                (fileUri != null ? "fileUri=" + fileUri + ", " : "") +
                (originalFileName != null ? "originalFileName=" + originalFileName + ", " : "") +
                (filePath != null ? "filePath=" + filePath + ", " : "") +
                (userId != null ? "userId=" + userId + ", " : "") +
                "}";
    }

}
